home *** CD-ROM | disk | FTP | other *** search
/ Programmers Heaven 2 / Programmers Heaven 2.iso / files / windows / ocx / wave.exe / WAVES1.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1996-07-18  |  7.3 KB  |  242 lines

  1. VERSION 4.00
  2. Begin VB.Form Form1 
  3.    Appearance      =   0  'Flat
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Wave VBX Action Sample"
  6.    ClientHeight    =   2550
  7.    ClientLeft      =   1650
  8.    ClientTop       =   1920
  9.    ClientWidth     =   4095
  10.    BeginProperty Font 
  11.       name            =   "MS Sans Serif"
  12.       charset         =   1
  13.       weight          =   700
  14.       size            =   8.25
  15.       underline       =   0   'False
  16.       italic          =   0   'False
  17.       strikethrough   =   0   'False
  18.    EndProperty
  19.    ForeColor       =   &H80000008&
  20.    Height          =   2955
  21.    Left            =   1590
  22.    LinkTopic       =   "Form1"
  23.    ScaleHeight     =   2550
  24.    ScaleWidth      =   4095
  25.    Top             =   1575
  26.    Width           =   4215
  27.    Begin VB.TextBox txtFileLength 
  28.       Appearance      =   0  'Flat
  29.       BeginProperty Font 
  30.          name            =   "MS Sans Serif"
  31.          charset         =   0
  32.          weight          =   400
  33.          size            =   8.25
  34.          underline       =   0   'False
  35.          italic          =   0   'False
  36.          strikethrough   =   0   'False
  37.       EndProperty
  38.       Height          =   285
  39.       Left            =   240
  40.       TabIndex        =   6
  41.       Top             =   1200
  42.       Width           =   3615
  43.    End
  44.    Begin VB.TextBox txtFilename 
  45.       Appearance      =   0  'Flat
  46.       BeginProperty Font 
  47.          name            =   "MS Sans Serif"
  48.          charset         =   0
  49.          weight          =   400
  50.          size            =   8.25
  51.          underline       =   0   'False
  52.          italic          =   0   'False
  53.          strikethrough   =   0   'False
  54.       EndProperty
  55.       Height          =   285
  56.       Left            =   240
  57.       TabIndex        =   3
  58.       Text            =   "C:\WINDOWS\RINGOUT.WAV"
  59.       Top             =   480
  60.       Width           =   3615
  61.    End
  62.    Begin VB.CommandButton btnStop 
  63.       Appearance      =   0  'Flat
  64.       BackColor       =   &H80000005&
  65.       Caption         =   "Stop"
  66.       BeginProperty Font 
  67.          name            =   "MS Sans Serif"
  68.          charset         =   0
  69.          weight          =   400
  70.          size            =   8.25
  71.          underline       =   0   'False
  72.          italic          =   0   'False
  73.          strikethrough   =   0   'False
  74.       EndProperty
  75.       Height          =   375
  76.       Left            =   2760
  77.       TabIndex        =   2
  78.       Top             =   1920
  79.       Width           =   1095
  80.    End
  81.    Begin VB.CommandButton btnPause 
  82.       Appearance      =   0  'Flat
  83.       BackColor       =   &H80000005&
  84.       Caption         =   "Resume"
  85.       BeginProperty Font 
  86.          name            =   "MS Sans Serif"
  87.          charset         =   0
  88.          weight          =   400
  89.          size            =   8.25
  90.          underline       =   0   'False
  91.          italic          =   0   'False
  92.          strikethrough   =   0   'False
  93.       EndProperty
  94.       Height          =   375
  95.       Left            =   1500
  96.       TabIndex        =   1
  97.       Top             =   1920
  98.       Width           =   1095
  99.    End
  100.    Begin VB.CommandButton btnPlay 
  101.       Appearance      =   0  'Flat
  102.       BackColor       =   &H80000005&
  103.       Caption         =   "Play"
  104.       BeginProperty Font 
  105.          name            =   "MS Sans Serif"
  106.          charset         =   0
  107.          weight          =   400
  108.          size            =   8.25
  109.          underline       =   0   'False
  110.          italic          =   0   'False
  111.          strikethrough   =   0   'False
  112.       EndProperty
  113.       Height          =   375
  114.       Left            =   240
  115.       TabIndex        =   0
  116.       Top             =   1920
  117.       Width           =   1095
  118.    End
  119.    Begin WaveLib.Wave Wave1 
  120.       Left            =   3360
  121.       Top             =   0
  122.       _version        =   65537
  123.       _extentx        =   847
  124.       _extenty        =   847
  125.       _stockprops     =   64
  126.       exclusive       =   0   'False
  127.       filename        =   ""
  128.       filelength      =   0
  129.       loop            =   0   'False
  130.       playend         =   -1
  131.       playstart       =   -1
  132.    End
  133.    Begin VB.Label Label2 
  134.       Appearance      =   0  'Flat
  135.       Caption         =   "File Length:"
  136.       BeginProperty Font 
  137.          name            =   "MS Sans Serif"
  138.          charset         =   0
  139.          weight          =   400
  140.          size            =   8.25
  141.          underline       =   0   'False
  142.          italic          =   0   'False
  143.          strikethrough   =   0   'False
  144.       EndProperty
  145.       ForeColor       =   &H80000008&
  146.       Height          =   255
  147.       Left            =   240
  148.       TabIndex        =   5
  149.       Top             =   960
  150.       Width           =   2415
  151.    End
  152.    Begin VB.Label Label1 
  153.       Appearance      =   0  'Flat
  154.       Caption         =   "Filename:"
  155.       BeginProperty Font 
  156.          name            =   "MS Sans Serif"
  157.          charset         =   0
  158.          weight          =   400
  159.          size            =   8.25
  160.          underline       =   0   'False
  161.          italic          =   0   'False
  162.          strikethrough   =   0   'False
  163.       EndProperty
  164.       ForeColor       =   &H80000008&
  165.       Height          =   255
  166.       Left            =   240
  167.       TabIndex        =   4
  168.       Top             =   240
  169.       Width           =   1935
  170.    End
  171. Attribute VB_Name = "Form1"
  172. Attribute VB_Creatable = False
  173. Attribute VB_Exposed = False
  174. Option Explicit
  175. Dim fChanged As Integer ' flag: has filename changed?
  176. Private Sub btnPause_Click()
  177.     ' if the user wants to pause
  178.     If btnPause.Caption = "Pause" Then
  179.         ' pause
  180.         Wave1.Action = 2
  181.     Else
  182.         ' resume
  183.         Wave1.Action = 3
  184.     End If
  185.     EnableButtons
  186. End Sub
  187. Private Sub btnPlay_Click()
  188.     ' make sure the filename is up to date
  189.     SetFilename
  190.     ' play the file
  191.     Wave1.Action = 1
  192.     EnableButtons
  193. End Sub
  194. Private Sub btnStop_Click()
  195.     ' stop playing
  196.     Wave1.Action = 4
  197.     ' update buttons
  198.     EnableButtons
  199. End Sub
  200. Private Sub EnableButtons()
  201.     Select Case Wave1.Status
  202.         Case 1: ' playing
  203.             If btnPause.Caption <> "Pause" Then
  204.                 btnPause.Caption = "Pause"
  205.             End If
  206.             btnStop.Enabled = True
  207.             btnPause.Enabled = True
  208.         Case 2: ' paused
  209.             If btnPause.Caption <> "Resume" Then
  210.                 btnPause.Caption = "Resume"
  211.             End If
  212.             btnStop.Enabled = True
  213.             btnPause.Enabled = True
  214.         Case 4: ' stopped
  215.             If btnPause.Caption <> "Pause" Then
  216.                 btnPause.Caption = "Pause"
  217.             End If
  218.             btnStop.Enabled = False
  219.             btnPause.Enabled = False
  220.     End Select
  221. End Sub
  222. Private Sub Form_Load()
  223.     fChanged = True
  224.     EnableButtons
  225. End Sub
  226. Private Sub SetFilename()
  227.     ' if the filename has changed, tell Wave VBX
  228.     If fChanged Then
  229.         ' changed no more
  230.         fChanged = False
  231.         Wave1.filename = txtFilename
  232.         ' set the file length field
  233.         txtFileLength = Format(Wave1.FileLength / 1000, "0.000") & " seconds"
  234.     End If
  235. End Sub
  236. Private Sub txtFilename_Change()
  237.     fChanged = True
  238. End Sub
  239. Private Sub Wave1_PlayDone()
  240.     EnableButtons
  241. End Sub
  242.